

******************************************************************************************************************************
*** Replication code for "Foreign Faith and Rising State: An Examination of State-Building Dynamics in Late 16th Century Japan"
****************************** Authors: Minzhao Wang, Austin M. Mitchell, Weiwen Yin *****************************************
******************************************************************************************************************************



// set working directory
cd ""


clear all
macro drop _all



// install packages
*ssc install evalue
*ssc install avar
*ssc install weakivtest

	   
		  
************************************************************

* Main Text

************************************************************


use "province_panel.dta", clear


*** Table 1: Explaining Toyotomi land surveys, logit models

global covars_logit "church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3" 

logit inspect $covars_logit, cluster(_ID)  
margins, dydx(church)

logit inspect $covars_logit i.year, cluster(_ID)  
margins, dydx(church)

logit inspect $covars_logit if partial==1, cluster(_ID)
margins, dydx(church)

logit inspect $covars_logit i.year if partial==1 , cluster(_ID)
margins, dydx(church)



	  

*** Table 2: Explaining Toyotomi land surveys, spatial panel models

set seed 2024  

spmatrix create contiguity C if year==1598, normalize(row) replace   // creating spatial matrix: contiguity with row normalization
spmatrix create idistance W if year==1598, normalize(minmax) replace // creating spatial matrix: inverse distance

global covars_sar "church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth battle battle_past pop1600_mil t" 

spxtregress inspect $covars_sar i.year, dvarlag(C) ivarlag(C: church) errorlag(C) re force // GNS
estat impact

spxtregress inspect $covars_sar i.year, dvarlag(C) errorlag(C) re force // SAC

spxtregress inspect $covars_sar i.year, dvarlag(C) ivarlag(C: church) re force // SDM

spxtregress inspect $covars_sar i.year, ivarlag(C: church) errorlag(C) re force // SDEM

spxtregress inspect $covars_sar i.year, dvarlag(C) re force // SAR

spxtregress inspect $covars_sar i.year, ivarlag(C: church) re force // SLX

spxtregress inspect $covars_sar i.year, errorlag(C) re force // SEM


	  
	  

*** Table 3: Sensitivity analysis using E-values

ssc install evalues

** logit with full sample
logit inspect $covars_logit, cluster(province)  

margins, at(church = (0 1))
display .2006832 /.1227409    // rr  1.6350149
evalue rr 1.6350149  //  2.654

* e-value of agricultural suitability 
centile (ag_mean), centile (25 75)
margins, at(ag_mean = ( 5.298056 12.58314 )) 
display  .1564549 /.135008    // rr 1.1588565
evalue rr 1.1588565    //  1.588

* e-value of area 
centile (area), centile (25 75)
margins, at(area = ( .1875 .4583333 )) 
display  .1497565  /.1335596    // rr 1.121271
evalue rr 1.121271   // 1.490


** logit with partial sample
logit inspect $covars_logit if partial==1, cluster(province)

margins, at(church = (0 1))
display  .235171/ .1487497   // rr 1.5809847
evalue rr 1.5809847  //   2.539

* e-value of agricultural suitability 
centile (ag_mean), centile (25 75)
margins, at(ag_mean = ( 5.298056 12.58314 )) 
display  .190631 /.16044      // rr 1.1881763
evalue  rr 1.1881763  // 1.661

* e-value of area 
centile (area), centile (25 75)
margins, at(area = ( .1875 .4583333  )) 
display  .1825708 / .1584575   // rr 1.1521752
evalue  rr 1.1521752   //  1.571


** spatial models (model 11)
spxtregress inspect $covars_sar  i.year,  errorlag(C) re force // SEM

margins, at(church = (0 1))
display .1859911  /  .129307  // rr 1.4383684
evalue rr 1.4383684  //    2.232

margins, at(ag_mean = ( 5.298056 12.58314 )) 
display  .1581995 / .1382732     // rr 1.1441082
evalue rr 1.1441082  // 1.550

margins, at(area = ( .1875 .4583333 )) 
display .1510959/.1384886       // rr 1.0910349
evalue rr 1.0910349    // 1.406





***  Table 4: Instrumental variable approach, second-stage results

ivprobit  inspect  (church = battle_by1550), vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit  inspect t (church = battle_by1550 t), vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit  inspect battle1550_1582 dist_yamashiro_l  t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l t), vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit  inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t), vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit  inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600   _CX _CY battle battle_past t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past t), vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit  inspect battle1550_1582 ag_mean elev_mean elev_std  area pop1600 dist_yamashiro_l _CX _CY invade rule_lth battle battle_past t  (church = battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t), vce(cluster _ID) first 
margins, dydx(church) predict(pr fix(church)) post




	  	  
*** Table 5: Instrumental variable approach, first-stage results

reg church battle_by1550, cluster(_ID)

reg church battle_by1550 t, cluster(_ID)	  

reg church battle_by1550 battle1550_1582 dist_yamashiro_l t, cluster(_ID)	

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t, cluster(_ID)

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 _CX _CY battle battle_past t, cluster(_ID)

reg church battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t,  cluster(_ID)





************************************************************

* Appendix

************************************************************


*** Table A.2: Summary statistics for the outcome variable and covariates, partial sample
 
summarize inspect church ag_mean area pop1600_mil elev_mean elev_std dist_yamashiro_l _CX _CY  invade  rule_lth battle battle_past t  if partial==1



*** Table A.3: Summary statistics for the outcome variable and covariates, full sample
summarize inspect church ag_mean area pop1600_mil elev_mean elev_std dist_yamashiro_l _CX _CY  invade  rule_lth battle battle_past t



*** Table A.4: Summary statistics for the outcome variable and covariates, cross-sectional sample

by _ID, sort: egen total_inspect = sum(inspect)
summarize total_inspect church battle_by1550 ag_mean area pop1600 elev_mean elev_std  dist_yamashiro_l _CX _CY rule_lth if year == 1598



*** Table A.5: Explaining Toyotomi land surveys with random-effects

xtlogit inspect $covars_logit, re 
margins, dydx(church)

xtlogit inspect $covars_logit i.year, re  
margins, dydx(church)

xtlogit inspect $covars_logit if partial==1, re 
margins, dydx(church)

xtlogit inspect $covars_logit i.year if partial==1 , re 
margins, dydx(church)


	  
*** Table A.6: Explaining Toyotomi land surveys, spatial panel models with inverse-distance matrix  
	  
set seed 2024  

global covars_sar "church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth battle battle_past pop1600_mil t" 

spxtregress inspect $covars_sar i.year, dvarlag(W) ivarlag(W: church) errorlag(W) re force // GNS
estat impact

spxtregress inspect $covars_sar i.year, dvarlag(W) errorlag(W) re force // SAC

spxtregress inspect $covars_sar i.year, dvarlag(W) ivarlag(W: church) re force // SDM

spxtregress inspect $covars_sar i.year, ivarlag(W: church) errorlag(W) re force // SDEM

spxtregress inspect $covars_sar i.year, dvarlag(W) re force // SAR

spxtregress inspect $covars_sar i.year, ivarlag(W: church) re force // SLX

spxtregress inspect $covars_sar i.year, errorlag(W) re force // SEM

	

*** Table A.7: Instrumental variable probit models with partial sample

ivprobit inspect  (church = battle_by1550) if partial==1, vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit inspect t (church = battle_by1550 t) if partial==1, vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit inspect battle1550_1582 dist_yamashiro_l  t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l t)  if partial==1, vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t)  if partial==1, vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600   _CX _CY battle battle_past t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past t)  if partial==1, vce(cluster _ID) first
margins, dydx(church) predict(pr fix(church)) post

ivprobit inspect battle1550_1582 ag_mean elev_mean elev_std  area pop1600 dist_yamashiro_l _CX _CY invade rule_lth battle battle_past t  (church = battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t)  if partial==1, vce(cluster _ID) first 
margins, dydx(church) predict(pr fix(church)) post

	  
* Obtain F-statistics for the first-stage

reg church battle_by1550 if partial==1, cluster(_ID)
	  
reg church battle_by1550 t if partial==1, cluster(_ID)	  

reg church battle_by1550 battle1550_1582 dist_yamashiro_l t if partial==1, cluster(_ID)	

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t if partial==1, cluster(_ID)

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past t if partial==1, cluster(_ID)

reg church battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t if partial==1,  cluster(_ID)



*** Table A.8: Two-stage least-squares IV results, second-stage

ivregress 2sls inspect  (church = battle_by1550), cluster(_ID) first

ivregress 2sls inspect t (church = battle_by1550 t), cluster(_ID) first

ivregress 2sls inspect battle1550_1582 dist_yamashiro_l  t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l t), cluster(_ID) first

ivregress 2sls inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t), cluster(_ID) first

ivregress 2sls inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600   _CX _CY battle battle_past t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past t), cluster(_ID) first

ivregress 2sls inspect battle1550_1582 ag_mean elev_mean elev_std  area pop1600 dist_yamashiro_l _CX _CY invade rule_lth battle battle_past t  (church = battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t), cluster(_ID) first 



*** Table A.9: Two-stage least-squares IV results, first-stage

ssc install weakiv

reg church battle_by1550, cluster(_ID)

reg church battle_by1550 t, cluster(_ID)	  

reg church battle_by1550 battle1550_1582 dist_yamashiro_l t, cluster(_ID)	

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t, cluster(_ID)

reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past t, cluster(_ID)

reg church battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t,  cluster(_ID)


* AR test 	  
	  
weakiv ivregress 2sls inspect  (church = battle_by1550), cluster(_ID) first

weakiv ivregress 2sls inspect t (church = battle_by1550 t), cluster(_ID) first

weakiv ivregress 2sls inspect battle1550_1582 dist_yamashiro_l  t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l t), cluster(_ID) first

weakiv ivregress 2sls inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t), cluster(_ID) first

weakiv ivregress 2sls inspect battle1550_1582 dist_yamashiro_l ag_mean area pop1600   _CX _CY battle battle_past battle battle_past t  (church = battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY battle battle_past battle battle_past t), cluster(_ID) first

weakiv ivregress 2sls inspect battle1550_1582 ag_mean elev_mean elev_std  area pop1600 dist_yamashiro_l _CX _CY invade rule_lth battle battle_past t  (church = battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t), cluster(_ID) first 	  



*** Table A.10: The effect of battles prior to 1550 on battles during survey implementation
	  
probit battle battle_by1550 b b2 b3, cluster(_ID)
	  
probit battle battle_by1550 ag_mean area b b2 b3, cluster(_ID)	  

probit battle battle_by1550  dist_yamashiro_l ag_mean area b b2 b3, cluster(_ID)	

probit battle battle_by1550  dist_yamashiro_l ag_mean area pop1600 b b2 b3, cluster(_ID)

probit battle battle_by1550  dist_yamashiro_l ag_mean area pop1600 _CX _CY b b2 b3, cluster(_ID) 

probit battle battle_by1550  ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l  rule_lth b b2 b3,  cluster(_ID)



*** Table A.11: The effect of battles prior to 1550 on the existence of large daimyos

gen greatdaimyo = 0 
replace greatdaimyo = 1 if  CITY1 == "Owari"
replace greatdaimyo = 1 if  CITY1 == "Aki"
replace greatdaimyo = 1 if  CITY1 == "Echigo"

probit greatdaimyo  battle_by1550 if year == 1582,  vce(cluster _ID) 

probit  greatdaimyo  battle_by1550  battle1550_1582 dist_yamashiro_l  if year == 1582, vce(cluster _ID) 

probit  greatdaimyo  battle_by1550  battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY if year == 1582,  vce(cluster _ID) 

probit greatdaimyo  battle_by1550  battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l   if year == 1582,  vce(cluster _ID)  



*** Table A.12: Sensitivity analysis of first-stage results using E-values

// Table 5, model 18
reg church battle_by1550, cluster(_ID)
margins, at(battle_by1550 = (0 10))
display .3497887/.1534575   // rr  
evalue rr  2.2793848   //  3.987

// Table 5, model 19 
reg church battle_by1550 t, cluster(_ID)	  
margins, at(battle_by1550 = (0 10))
display .3514495/.1655817    // rr  
evalue rr  2.1225141   //  3.666 

// Table 5, model 20
reg church battle_by1550 battle1550_1582 dist_yamashiro_l t, cluster(_ID)	
margins, at(battle_by1550 = (0 10))
display .3471338/.134077     // rr  
evalue rr  2.589063   //  4.617

// Table 5, model 21
reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600 t, cluster(_ID)
margins, at(battle_by1550 = (0 10))
display .3484907/.1439822     // rr  
evalue rr 2.4203735    //  4.275

// Table 5, model 22
reg church battle_by1550 battle1550_1582 dist_yamashiro_l ag_mean area pop1600  _CX _CY t, cluster(_ID)
margins, at(battle_by1550 = (0 10))
display .3586856/.2184051    // rr  
evalue rr  1.642295   //  2.669

// Table 5, model 23
reg church battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t,  cluster(_ID)
margins, at(battle_by1550 = (0 10))
display .3587443/.2188335    // rr  
evalue rr  1.6393482   //  2.663

* e-value of agricultural suitability 
centile (ag_mean), centile (25 75)
margins, at(ag_mean = ( 5.298056 12.58314 )) 
display  .3919662/.3618967   // rr 
evalue rr 1.0830886    //  1.383

* e-value of area 
centile (area), centile (25 75)
margins, at(area = ( .1875 .4583333  )) 
display  .3803487 /.4193795   // rr 
evalue rr .90693203   // 1.439



* Table A.13: Differentiating the first survey and re-surveys, survival analysis

gen sample_firstsurvey=0
replace sample_firstsurvey=1 if cum_survey <= 1

gen sample_resurvey=0
replace sample_resurvey=1 if cum_survey >=1  &  inspect_count_by_kuni != 1

sort kuni year
stset year, failure(inspect)

stcox  church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil if sample_firstsurvey==1, cluster(_ID) nohr

stcox  church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil if sample_resurvey==1, cluster(_ID) nohr 



*** Table A.14: Explaining Toyotomi land surveys, IV with cross-sectional data

macro drop _all
capture drop total_inspect
by _ID, sort: egen total_inspect = sum(inspect)

sum total_inspect if year == 1598, d

ivregress 2sls total_inspect  (church = battle_by1550) if year==1598,  first

ivregress 2sls total_inspect dist_yamashiro_l (church = battle_by1550 dist_yamashiro_l) if year==1598,  first

ivregress 2sls total_inspect battle1550_1582 dist_yamashiro_l  (church = battle_by1550 battle1550_1582 dist_yamashiro_l) if year==1598,  first

ivregress 2sls total_inspect battle1550_1582 ag_mean area  pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area  pop1600 dist_yamashiro_l) if year==1598,  first

ivregress 2sls total_inspect battle1550_1582 ag_mean area _CX _CY pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area _CX _CY pop1600 dist_yamashiro_l) if year==1598,  first

ivregress 2sls total_inspect battle1550_1582 ag_mean area elev_mean elev_std _CX _CY rule_lth pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area elev_mean elev_std _CX _CY rule_lth pop1600 dist_yamashiro_l) if year==1598,  first

	  
* First-stage results

reg church battle_by1550 if year==1598

reg church battle_by1550 dist_yamashiro_l if year==1598

reg church battle_by1550 battle1550_1582 dist_yamashiro_l if year==1598

reg church battle_by1550 battle1550_1582 ag_mean area  pop1600 dist_yamashiro_l if year==1598

reg church battle_by1550 battle1550_1582 ag_mean area _CX _CY pop1600 dist_yamashiro_l if year==1598

reg church battle_by1550 battle1550_1582 ag_mean area elev_mean elev_std _CX _CY rule_lth pop1600 dist_yamashiro_l if year==1598


* AR Test for weak IV with cross-sectional data

weakiv ivregress 2sls total_inspect  (church = battle_by1550) if year==1598,  first

weakiv ivregress 2sls total_inspect dist_yamashiro_l (church = battle_by1550 dist_yamashiro_l) if year==1598,  first

weakiv ivregress 2sls total_inspect battle1550_1582 dist_yamashiro_l  (church = battle_by1550 battle1550_1582 dist_yamashiro_l) if year==1598,  first

weakiv ivregress 2sls total_inspect battle1550_1582 ag_mean area  pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area  pop1600 dist_yamashiro_l) if year==1598,  first

weakiv ivregress 2sls total_inspect battle1550_1582 ag_mean area _CX _CY pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area _CX _CY pop1600 dist_yamashiro_l) if year==1598,  first

weakiv ivregress 2sls total_inspect battle1550_1582 ag_mean area elev_mean elev_std _CX _CY rule_lth pop1600 dist_yamashiro_l (church = battle_by1550 battle1550_1582 ag_mean area elev_mean elev_std _CX _CY rule_lth pop1600 dist_yamashiro_l) if year==1598,  first



*** Table A.15: Explaining Toyotomi land surveys, using trade hubs as the treatment

global covars_port "ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3" 

logit inspect nanban $covars_port, cluster(_ID)  
margins, dydx(nanban)

logit inspect nanban $covars_port i.year, cluster(_ID)  
margins, dydx(nanban)

logit inspect nanban $covars_port if partial==1, cluster(_ID)
margins, dydx(nanban)

logit inspect nanban $covars_port i.year if partial==1 , cluster(_ID)
margins, dydx(nanban)

	 

*** Table A.16: Explaining Toyotomi land surveys, controlling for trade hubs	 

logit inspect church nanban $covars_port, cluster(_ID)  
margins, dydx(church)

logit inspect church nanban $covars_port i.year, cluster(_ID)  
margins, dydx(church)

logit inspect church nanban $covars_port if partial==1, cluster(_ID)
margins, dydx(church)

logit inspect church nanban $covars_port i.year if partial==1 , cluster(_ID)
margins, dydx(church)



*** Table A.17: Explaining Toyotomi land surveys, with castles and strongholds as proxy for state capacity

logit inspect church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 i.year l_total_castle if partial==1 , cluster(_ID)
margins, dydx(church)

logit inspect i.church##c.l_total_castle ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 i.year l_total_castle if partial==1 , cluster(_ID)
margins, dydx(church)
margins, dydx(church) at(l_total_castle=(1(1)7))
marginsplot

spxtregress inspect church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth battle battle_past pop1600_mil  t l_total_castle i.year, dvarlag(C) ivarlag(C: church) errorlag(C) re force // GNS
estat impact

spxtregress inspect i.church##c.l_total_castle ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth battle battle_past pop1600_mil  t l_total_castle i.year, dvarlag(C) ivarlag(C: church) errorlag(C) re force // GNS
estat impact

ivprobit  inspect battle1550_1582 ag_mean elev_mean elev_std  area pop1600 dist_yamashiro_l _CX _CY invade rule_lth battle battle_past t l_total_castle  (church = battle_by1550 battle1550_1582 ag_mean elev_mean elev_std _CX _CY area pop1600 dist_yamashiro_l invade rule_lth battle battle_past t l_total_castle)  if partial==1, vce(cluster _ID) 
margins, dydx(church) predict(pr fix(church)) post	  

	  

*** Table A.18: Explaining Toyotomi land surveys, with town density as proxy for urbanization	  

logit inspect i.church c.town_density ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle i.year  if partial==1 , cluster(_ID)

logit inspect i.church c.town_density ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle i.year, cluster(_ID)

logit inspect i.church##c.town_density ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle i.year  if partial==1 , cluster(_ID)
margins, dydx(church)
margins, dydx(church) at(town_density=(0(2)24))	  
marginsplot, plot1opts(lpattern(solid) lcolor(black)) ///
graphregion(color(white)) yline(0,lwidth(vthin) lcolor(black) lpattern(dash)) ///
ci1opts(recast(rline) fintensity(15) lpattern(dash_3dot) lcolor(black)) recast(line) ///
 ytitle("") xtitle("Town Density") xlabel(0(4)24) title("AME of Church Presence (Partial Sample)") level(95) saving(ame1.gph, replace)

logit inspect i.church##c.town_density ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle i.year, cluster(_ID)
margins, dydx(church)	  	  
margins, dydx(church) at(town_density=(0(1)23))	  
marginsplot, plot1opts(lpattern(solid) lcolor(black)) ///
graphregion(color(white)) yline(0,lwidth(vthin) lcolor(black) lpattern(dash)) ///
ci1opts(recast(rline) fintensity(15) lpattern(dash_3dot) lcolor(black)) recast(line) ///
 ytitle("") xtitle("Town Density") xlabel(0(4)24) title("AME of Church Presence (Full Sample)") level(95) saving(ame2.gph, replace)

gr combine ame1.gph ame2.gph, graphregion(color(white)) col(3)  iscale(0.5) saving(ame_town, replace) ycommon


	  
*** Table A.19: Explaining Toyotomi land surveys, with different exposure to Christian influence

logit inspect strong_influence moderate_influence ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle town_density i.year if partial==1, cluster(_ID)
margins, dydx(strong_influence)	  	  
margins, dydx(moderate_influence)	  	  

logit inspect strong_influence moderate_influence ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil t t2 t3 l_total_castle town_density i.year , cluster(_ID)
margins, dydx(strong_influence)	  	  
margins, dydx(moderate_influence)	



*** Table A.20: Explaining Toyotomi land surveys, excluding capital area

gen capital = 0
foreach n in 27 29 31 32 33 35 36 {
replace capital = 1 if _ID == `n'
} 

global covars_logit "church ag_mean area elev_mean elev_std dist_yamashiro_l _CX _CY invade rule_lth  battle battle_past pop1600_mil  t t2 t3" 

logit inspect $covars_logit if capital!= 1, cluster(_ID)  
margins, dydx(church)

logit inspect $covars_logit i.year  if capital!= 1, cluster(_ID)  
margins, dydx(church)

logit inspect $covars_logit if partial==1  & capital!= 1, cluster(_ID)
margins, dydx(church)

logit inspect $covars_logit i.year if partial==1  & capital!= 1, cluster(_ID)
margins, dydx(church)

